package com.fduss.mazegame.core.unit;

import com.fduss.mazegame.core.maze.Maze;
import com.fduss.mazegame.core.unit.feature.HasEvent;
import com.fduss.mazegame.core.unit.feature.HasIcon;

/**
 * // The maze will be populated with "entities".
 //
 // Entities will have a place in the maze and an Icon so they can
 // be rendered by the clients.
 //
 // Entities are static, this is, their place can not be changed once
 // the object is constructed. The Mob subclass allows for moving
 // entities.
 */
public abstract class Entity implements HasIcon, HasEvent {

    protected Place place;

    Entity(Place place) {
        if (place == null) {
            throw new NullPointerException("place");
        }
        if (!place.isWalkable()) {
            throw new IllegalArgumentException("place is not walkable");
        }
        this.place = place;
        this.place.addEntity(this);
    }

    public Place getPlace() {
        return place;
    }

    public void setPlace(Place place) {
        this.place.rmEntity(this);
        this.place = place;
        this.place.addEntity(this);
    }

    @Override
    public void handleEvent(Maze maze, HasEvent ob) {

    }
}
